﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace aztall.Module.BusinessObjects
{
	public static class Extensions
	{
		public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
		{
			int diff = dt.DayOfWeek - startOfWeek;
			if (diff < 0)
			{
				diff += 7;
			}
			return dt.AddDays(-1 * diff).Date;
		}
		public static int PromoDays(this Promo promo)
		{
			return (promo.EndDate - promo.StartDate).Days + 1;
		}
	}
}
